package com.sugar.domain.oa.hr;

import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.sugar.base.enums.Gender;
import com.sugar.domain.system.privilege.PrivilegeRole;


/**
 * @标题：员工实体
 * @描述：
 * @编写者：杨浩泉
 * @日期：2011-8-26 <b>下午11:35:24</b>
 */
@Entity@Table(name="sugar_employee")
public class Employee {
	
	/** 员工编号，8位 */
	private String empNo ;
	
	/** 员工名称 */
	private String empRealname ;
	
	/** 应聘职位 */
	private String acceptJob ;
	
	/** 民族 */
	private String nation ;
	
	/** 性别 */
	private Gender gender = Gender.MAN ;
	
	/** 出生年月日,采用只含有日期部分的类型表示 */
	private String birthday;
	
	/** 毕业学校 */
	private String school ;
	
	/** 文化程度 */
	private String educational ;
	
	/** 所学专业 */
	private String speciality ;
	
	/** 工作年限 */
	private String ageJob ;
	
	/** 籍贯 */
	private String natives ;
	
	/** 户口所在地*/
	private String residence ;
	
	/** 现居住地址*/
	private String residentialAddr ;
	
	/** 联系电话 */
	private String tel ;

	/** 移动电话 */
	private String mobileTel ;

	/** 电子邮件 */
	private String email ;
	
	/** 紧急联系人 */
	private String emergency ; 
	
	/** 紧急联系人电话 */
	private String emergencyTel ; 
	
	/** 员工图片 */
	private String empImage ;

	/** 入职日期 */
	private String appointmentDate ;
	
	/** 员工添加日期 */
	private Date empCreDate = new Date();

	/** 员工在职状态， true为在职/false为离职 */
	private boolean visible = true ;

	/** 员工与部门多对一关联关系 **/
	private Department dept ;
	
	/** 员工信息与员工账号一对一关联关系 **/
	private EmpAccount account ;
	
	private Set<PrivilegeRole> role ;
	
	@ManyToMany(fetch=FetchType.EAGER)
	@JoinTable(name="sugar_privilege_role_emp",
			joinColumns={@JoinColumn(name="empid_roleid")},
			inverseJoinColumns={@JoinColumn(name="roleid_empid")})
	public Set<PrivilegeRole> getRole() {
		return role;
	}

	public void setRole(Set<PrivilegeRole> role) {
		this.role = role;
	}

	@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	@JoinColumn(name="ea_id")
	public EmpAccount getAccount() {
		return account;
	}

	public void setAccount(EmpAccount account) {
		this.account = account;
	}

	@ManyToOne
	@JoinColumn(name="de_id")
	public Department getDept() {
		return dept;
	}

	public void setDept(Department dept) {
		this.dept = dept;
	}

	@Id
	public String getEmpNo() {
		return empNo;
	}

	public void setEmpNo(String empNo) {
		this.empNo = empNo;
	}

	public String getEmpRealname() {
		return empRealname;
	}

	public void setEmpRealname(String empRealname) {
		this.empRealname = empRealname;
	}


	public String getAcceptJob() {
		return acceptJob;
	}

	public void setAcceptJob(String acceptJob) {
		this.acceptJob = acceptJob;
	}

	public String getNation() {
		return nation;
	}

	public void setNation(String nation) {
		this.nation = nation;
	}

	public Gender getGender() {
		return gender;
	}

	public void setGender(Gender gender) {
		this.gender = gender;
	}

	public String getBirthday() {
		return birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	public String getSchool() {
		return school;
	}

	public void setSchool(String school) {
		this.school = school;
	}

	public String getEducational() {
		return educational;
	}

	public void setEducational(String educational) {
		this.educational = educational;
	}

	public String getSpeciality() {
		return speciality;
	}

	public void setSpeciality(String speciality) {
		this.speciality = speciality;
	}

	public String getAgeJob() {
		return ageJob;
	}

	public void setAgeJob(String ageJob) {
		this.ageJob = ageJob;
	}

	public String getNatives() {
		return natives;
	}

	public void setNatives(String natives) {
		this.natives = natives;
	}

	public String getResidence() {
		return residence;
	}

	public void setResidence(String residence) {
		this.residence = residence;
	}

	public String getResidentialAddr() {
		return residentialAddr;
	}

	public void setResidentialAddr(String residentialAddr) {
		this.residentialAddr = residentialAddr;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getMobileTel() {
		return mobileTel;
	}

	public void setMobileTel(String mobileTel) {
		this.mobileTel = mobileTel;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getEmergency() {
		return emergency;
	}

	public void setEmergency(String emergency) {
		this.emergency = emergency;
	}

	public String getEmergencyTel() {
		return emergencyTel;
	}

	public void setEmergencyTel(String emergencyTel) {
		this.emergencyTel = emergencyTel;
	}

	public String getEmpImage() {
		return empImage;
	}

	public void setEmpImage(String empImage) {
		this.empImage = empImage;
	}

	public String getAppointmentDate() {
		return appointmentDate;
	}

	public void setAppointmentDate(String appointmentDate) {
		this.appointmentDate = appointmentDate;
	}

	@Temporal(TemporalType.DATE)
	public Date getEmpCreDate() {
		return empCreDate;
	}

	public void setEmpCreDate(Date empCreDate) {
		this.empCreDate = empCreDate;
	}

	public boolean isVisible() {
		return visible;
	}

	public void setVisible(boolean visible) {
		this.visible = visible;
	}
	
}
